namespace ConsoleApp1;

public struct Rectangle
{
    public float X { get; set; }
    public float Y { get; set; }
    public float Width { get; set; }
    public float Height { get; set; }

    public Rectangle(float x, float y, float width, float height)
    {
        X = x;
        Y = y;
        Width = width;
        Height = height;
    }

    public static bool CheckCollision(Rectangle rect1, Rectangle rect2)
    {
        return rect1.X < rect2.X + rect2.Width &&
               rect1.X + rect1.Width > rect2.X &&
               rect1.Y < rect2.Y + rect2.Height &&
               rect1.Y + rect1.Height > rect2.Y;
    }
}

public struct Circle
{
    public float X { get; set; }
    public float Y { get; set; }
    public float Radius { get; set; }

    public Circle(float x, float y, float radius)
    {
        X = x;
        Y = y;
        Radius = radius;
    }

    public static bool CheckCollision(Circle circle1, Circle circle2)
    {
        float dx = circle2.X - circle1.X;
        float dy = circle2.Y - circle1.Y;
        float distance = MathF.Sqrt(dx * dx + dy * dy);

        return distance < circle1.Radius + circle2.Radius;
        // return (circle1.X - circle2.X) * (circle1.X - circle2.X) +
        //        (circle1.Y - circle2.Y) * (circle1.Y - circle2.Y) <=
        //        (circle1.Radius + circle2.Radius) * (circle1.Radius + circle2.Radius);
    }
}